#!/usr/bin/env bash

source /etc/profile
cd /home/marvin/sqoop-1.4.6-cdh5.6.0

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_recharge;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_recharge --export-dir /user/hive/warehouse/res_recharge/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_addVip_cd;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_addVip_cd --export-dir /user/hive/warehouse/res_addvip_cd/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_vipEvaluation_all;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_vipEvaluation_all --export-dir /user/hive/warehouse/res_vipevaluation_all/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_oil;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_oil --export-dir /user/hive/warehouse/res_oil/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_notoilDepartment;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_notoilDepartment --export-dir /user/hive/warehouse/res_notoildepartment/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_notoilTop;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_notoilTop --export-dir /user/hive/warehouse/res_notoiltop/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_lube;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_lube --export-dir /user/hive/warehouse/res_lube/ --input-fields-terminated-by ',' -m 1 --input-null-string '\\N' --input-null-non-string '\\N'

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_notoilRate;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_notoilRate --export-dir /user/hive/warehouse/res_notoilrate/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_mop;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_mop --export-dir /user/hive/warehouse/res_mop/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_HHTIPT;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_HHTIPT --export-dir /user/hive/warehouse/res_hhtipt/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_oil_vip;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_oil_vip --export-dir /user/hive/warehouse/res_oil_vip --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_notoil_vip;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_notoil_vip --export-dir /user/hive/warehouse/res_notoil_vip --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_notoilTop_vip;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_notoilTop_vip --export-dir /user/hive/warehouse/res_notoiltop_vip/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_lube_vip;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_lube_vip --export-dir /user/hive/warehouse/res_lube_vip/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_notoilRate_vip;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_notoilRate_vip --export-dir /user/hive/warehouse/res_notoilrate_vip/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_mop_vip;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_mop_vip --export-dir /user/hive/warehouse/res_mop_vip/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_HHTIPT_vip;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_HHTIPT_vip --export-dir /user/hive/warehouse/res_hhtipt_vip/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_recharge_cd;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_recharge_cd --export-dir /user/hive/warehouse/res_recharge_cd/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_oilb_vip;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_oilb_vip --export-dir /user/hive/warehouse/res_oilb_vip --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_oilb;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_oilb --export-dir /user/hive/warehouse/res_oilb/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_addVip;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_addVip --export-dir /user/hive/warehouse/res_addvip/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_notoil;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_notoil --export-dir /user/hive/warehouse/res_notoil/ --input-fields-terminated-by ',' -m 1
